package com.mxpio.erp.common.quality.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.filestorage.annotation.FileName;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_QUALITY_IS")
@Schema(description="质检方案")//质检方案
public class InspectionScheme extends BaseEntity{
	private static final long serialVersionUID = 1L;

	@Id
	@Generator(policy = ResCodeGeneratorPolicy.class)
	@Column(name = "CODE_", updatable = false)
	@Schema(description = "方案编号")
	private String code;

	@Column(name = "NAME_")
	@Schema(description = "方案名称")
	private String name;

	@Column(name = "BPMN_STATUS_")
	@Schema(description = "审核状态")
	@Dict(dicCode = "ERP_COMMON_BPMN_STATUS")
	private String bpmnStatus;

	@Column(name = "REVIEWER_")
	@Schema(description = "审核人")
	@Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
	private String reviewer;

	@Column(name = "REVIEW_TIME_")
	@Schema(description = "审核时间")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	private Date reviewTime;

	@Column(name = "BUSI_TYPE_")
	@Schema(description = "适用业务类型")
	@Dict(dicCode = "ERP_QUAL_IS_BUSI_TYPE")
	private String busiType;

	@Column(name = "DESCRIPTION_")
	@Schema(description = "方案说明")
	private String description;


	@Column(name = "ATTACHMENT_")
	@Schema(description = "附件")
	@FileName
	private String attachment;

	@Transient
	private List<InspectionSchemeLine> lineList;

	@Transient
	private List<InspectionSchemeChain> inspectionSchemeChains;
}
